using System;
using System.Collections.Generic;
using System.Text;

namespace AUSRIS.Reports.Utilities.Deployment.Entities
{
    public class Folder : DeploymentItem, IComparable<Folder>
    {
        #region Private Fields

        private IList<CatalogFile> files;
        private IList<DataSource> dataSources;

        #endregion

        #region Constructor(s)

        public Folder(string name, Folder parent)
            : base(name, parent)
        {
            this.files = new List<CatalogFile>();
            this.dataSources = new List<DataSource>();
        }

        public Folder(string name)
            : this(name, null)
        {
        }

        #endregion

        #region Public Properties

        public IList<CatalogFile> Files
        {
            get
            {
                return files;
            }
        }

        public IList<DataSource> Datasources
        {
            get
            {
                return dataSources;
            }
        }

        #endregion

        #region Public Methods

        public bool ContainsFile(CatalogFile file)
        {
            foreach(CatalogFile catalogFile in this.Files)
            {
                if(file.Name == catalogFile.Name)
                {
                    return true;
                }
            }
            return false;
        }

        #endregion

        #region IComparable<Folder> Members

        public int CompareTo(Folder other)
        {
            return this.Path.CompareTo(other.Path);
        }

        #endregion
    }
}